package tests;

import static org.junit.Assert.*;

import org.junit.Test;

import entities.Inventory;
import fields.LaborCamp;
import gstd.Player;

public class TestLaborCamp {

	@Test
	public void testGetRent() {
		LaborCamp f = new LaborCamp("LaborCamp", 100, 100);
		LaborCamp f2 = new LaborCamp("LaborCamp", 200, 100);

		assertEquals(100, f.getRent());
		assertEquals(200, f2.getRent());
	}

	// landOnField on LaborCamp will make a calculation of baseRent * numberOfLaborCamps * diceSum
	@Test
	public void testLandOnLaberCamp() {
		LaborCamp f = new LaborCamp("LaborCamp", 100, 300);

		Player p1 = new Player("Player 1", new Inventory(2000));
		Player p2 = new Player("Player 2", new Inventory(2000));

		f.setBuyFieldDecision(true);
		f.landOnField(p1);

		assertEquals(f.getOwner().getName(), p1.getName());
		assertEquals(1700, p1.getInventory().getBalance());
		
		// First test
		// landOnField() calculates 100 * 1 * 3
		p2.setDiceSum(10);
		f.landOnField(p2);

		assertEquals(2700, p1.getInventory().getBalance());
		assertEquals(1000, p2.getInventory().getBalance());

	}

}
